package org.example.anno_ioc_di;

import org.springframework.beans.factory.annotation.Value;

/**
 * @author 李新雨的项目86176
 * @version 1.0
 * @date 2024-11-11 16:20
 */
public class Dog {
    @Value("小黑子")
    private String name;
    @Value("黑色的")
    private String color;
    public Dog() {

    }
    public Dog(String name, String color) {
        this.name = name;
        this.color = color;
    }

    public String getName() {
        return name;
    }
    //没有setXxx方法，利用spring注解
//    @Value("小黑")
//    public void setName(String name) {
//        this.name = name;
//    }
    public String getColor() {
        return color;
    }
    //利用spring注解
    @Value("黑色")
    public void setColor(String color) {
        this.color = color;
    }
    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", color='" + color + '\'' +
                '}';
    }

}
